package com.oc.queuep.map.view.overlay;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;

import com.baidu.mapapi.GeoPoint;
import com.baidu.mapapi.MapView;
import com.baidu.mapapi.Overlay;

public final class PeopleLocationOverlay extends Overlay
{
    private Paint m_paint = new Paint();
    private GeoPoint m_geoPoint = new GeoPoint(0, 0);
    private String m_text = "Not assigned";

    public PeopleLocationOverlay(GeoPoint point, String text)
    {
        this.m_geoPoint = point;
        this.m_text = text;
    }

    @Override
    public void draw(Canvas canvas, MapView mapView, boolean shadow)
    {
        Point point = mapView.getProjection().toPixels(m_geoPoint, null);

        int width = 50;
        int height = 50;
        RectF rect = new RectF((float) point.x - (float) width / 2, (float) point.y - (float) height / 2, (float) point.x , (float) point.y);

        m_paint.setColor(Color.BLUE);
        // canvas.drawRect(rect, m_paint);
        canvas.drawArc(rect, 0, 360, true, this.m_paint);

        m_paint.setColor(Color.RED);
        canvas.drawText(this.m_text, point.x, point.y, this.m_paint);
    }
}
